const arr = [
    { a: 1, b: 2 },
    { a: 1, b: 2 },
    { a: 1, b: 2, c: { a: 1, b: 2 } },
    { a: 1, b: 2, c: { a: 1, b: 2 } },
]

const isObject = (val) => typeof val === 'object' && val !== null

function equals(v1, v2) {
    if (!isObject(v1) || !isObject(v2)) {
        return Object.is(v1, v2)
    }

    const keys1 = Object.keys(v1);
    const keys2 = Object.keys(v2);

    if (keys1.length !== keys2.length) {
        return false;
    }
    for (const key of keys1) {
        if (!keys2.includes(key)) {
            return false;
        }
        if (!equals(v1[key], v2[key])) {
            return false
        }
    }

    return true;
}

const result = []
for (const item of arr) {
    let isFound = false;
    for (let r of result) {
        if (equals(item, r)) {
            isFound = true;
            break;
        }
    }
    if (!isFound) {
        result.push(item)
    }
}

console.info(result)